<?php
class M_post extends Module {
  public function main() {
    if ( Site::$ajax ) {
      header( 'Content-Type: text/xml' );
      $xml = new Template('xml');
      $sql = "SELECT * FROM `posts` WHERE `id`='#'";
      $r = db::q( $sql, Site::$URL[2] )->assoc();
      $xml->add( 'data', "<text><![CDATA[".$r['text']."]]></text>");
      echo $xml;
    } else {
      $tmp = new Template('post');
      $post = publication_find( Site::$URL[3], Site::$URL[2] );
      $tmp->assign( 'p', $post );
      return $tmp;
    }
  }
}

?>